package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    /**
     * @param latitude 纬度
     * @param longitude 经度
     * @param address 位置
     */
    public void location(Double latitude, Double longitude, String address) {
        //获取用户id
        Long userId = UserHolder.getUserId();
        //调用api保存或者更新数据库
        userLocationApi.save(latitude,longitude,address,userId);
    }
}
